package school.struts;

import javax.annotation.Resource;

import org.apache.log4j.Logger;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Results;

import org.apache.struts2.convention.annotation.Result;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Controller;

import school.entity.Student;
import school.service.IStudentService;

@Controller   @Scope("prototype")
@Results(@Result(name="success",location="/index.jsp"))
public class StudentAction {
	private final Logger log=Logger.getLogger(this.getClass());
	
	@Autowired
	private IStudentService studentService;
	
	
	@Action(value="add")
	public String add()
	{
		Student student;
		student=studentService.findById(1);
		log.info("action add");
		return "success";
	}
	@Action(value="list")
	public String list()
	{
		
		log.info("student list");
		return "success";
	}
}
